package cn.zz.veggie.web.types.dto.mgmt.purchase;

import java.time.ZonedDateTime;

import cn.zz.comm.util.DateUtil;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Positive;
import lombok.Getter;
import lombok.Setter;

/**
 * @author zhongq
 * @since 2024/7/28
 */
@Getter
@Setter
public class MgmtPurchaseCreateDto {

	@NotNull
	@Positive
	private Long statTime;

	public void requireValid() {
		final ZonedDateTime dateTime = DateUtil.zonedDateTime(statTime);
		// 0-12 0
		// 12 - 24 1
		statTime = dateTime.withHour((dateTime.getHour() / 12) * 12).withSecond(0).withMinute(0).toEpochSecond();
	}

}